package com.tang.common.config;

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;


/**
 * @author 唐朝阳
 */
/*@Configuration
@EnableSwagger2WebMvc*/
public class Knife4jConfiguration {

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("唐朝阳的招聘网站API文档")
                        .description("文档很详细，注释很清晰，跟我一起开发很愉快")
                        .termsOfServiceUrl("http://www.baidu.com")
                        .contact(new Contact("唐朝阳","http://www.baidu.com","1802361359@qq.com"))
                        .version("1.0")
                        .build())
                //分组名称
                .groupName("2.X版本")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.tang"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
